package com.xiaolin.designmode.flyweight;

/**
 * @ClassName FlyweightTest
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/11/3
 * @Version 1.0
 */
public class FlyweightTest {
    public static void main(String[] args) {
        FlyweightFactory factory=new FlyweightFactory();
        Flyweight a1 = factory.flyweight("a");
        Flyweight a2 = factory.flyweight("a");
        Flyweight a3 = factory.flyweight("a");
        Flyweight b1 = factory.flyweight("b");
        Flyweight b2 = factory.flyweight("b");
        a1.operation(new UnsharableFlyweight("第一次调用a"));
        a2.operation(new UnsharableFlyweight("第二次调用a"));
        a3.operation(new UnsharableFlyweight("第三次调用a"));
        b1.operation(new UnsharableFlyweight("第一次调用b"));
        b2.operation(new UnsharableFlyweight("第二次调用b"));

    }
}
